import { app as server, initApp } from './app';
import { SERVER } from './core/loadConfig.ts';
import { getIpAddress } from './core/utils.ts';

initApp();

server.listen(SERVER.PORT, () => {
  const ip = getIpAddress();
  const LANAddress = ip ? `http://${ip}:${SERVER.PORT}` : '';
  const localAddress = `http://localhost:${SERVER.PORT}`;
  console.log(`服务器正在运行： \n内网地址：${LANAddress}\n本机地址：${localAddress}`);
});

server.on('error', (err: Error) => {
  console.error(err);
});
